package com.sali.asyncollection.service.impl;


import com.sali.asyncollection.model.BaseRspDTO;
import com.sali.asyncollection.model.UserInfoDTO;
import com.sali.asyncollection.model.UserInfoParam;
import com.sali.asyncollection.service.IBaseTask;
import com.sali.asyncollection.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @description: 用户信息策略类
 * @author: zhang hang
 * @date: 2023/3/15 20:55.
 * @version: 1.0
 */
@Service
public class UserStrategyTask implements IBaseTask {

    @Autowired
    private IUserService userService;

    @Override
    public String getTaskType() {
        return "userInfoDTO";
    }

    @Override
    public BaseRspDTO<Object> execute(String req) {
        UserInfoParam userInfoParam = new UserInfoParam(req);
        UserInfoDTO userInfoDTO = userService.queryUserInfo(userInfoParam);
        BaseRspDTO<Object> userBaseRspDTO = new BaseRspDTO<Object>();
        userBaseRspDTO.setKey(getTaskType());
        userBaseRspDTO.setData(userInfoDTO);
        return userBaseRspDTO;
    }
}
